package com.zbkj.crmeb.merchant.api.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.common.CommonPage;
import com.common.PageParamRequest;
import com.zbkj.crmeb.front.request.*;
import com.zbkj.crmeb.front.response.ConfirmOrderResponse;
import com.zbkj.crmeb.front.response.OrderDataResponse;
import com.zbkj.crmeb.front.response.OrderPayResponse;
import com.zbkj.crmeb.front.response.StoreOrderDetailResponse;
import com.zbkj.crmeb.front.vo.OrangeWechatAppletConfigVo;
import com.zbkj.crmeb.front.vo.OrderAgainVo;
import com.zbkj.crmeb.marketing.response.StoreCouponUserResponse;
import com.zbkj.crmeb.merchant.api.request.UpdatePickingProductRequest;
import com.zbkj.crmeb.store.model.StoreOrder;
import com.zbkj.crmeb.store.model.StoreOrderInfo;
import com.zbkj.crmeb.store.request.StoreOrderSendRequest;
import com.zbkj.crmeb.store.request.StoreProductReplyAddRequest;

/**
 * @Classname StoreOrderService
 * @Description H5端订单操作
 * @Date 2020/7/4 11:16 上午
 * @Created by stivepeim
 */
public interface MerOrderService {
    /**
     * 订单确认
     * @param cartIds 购物车id集合
     * @return 确认订单信息
     */
    ConfirmOrderResponse confirmOrder(List<Integer> cartIds, boolean isNew, Integer merId, Integer skuId, Integer discountPackageId, String groupId);

    /**
     * 创建订单
     * @param request 创建订单参数
     * @param key 订单key
     * @return payResponse
     */
    OrderPayResponse createOrder(OrderCreateRequest request, String key, String ip);

    /**
     * 再次支付
     * @author daigb
     * @date:  2022-07-18 16:01
     */
    OrderPayResponse getPayToken(String orderId, Integer merId, String ip);

    /**
     * 再次下单
     * @param request 参数
     * @return 下单结果
     */
    HashMap<String, Object> againOrder(OrderAgainRequest request);

    /**
     * 计算订单金额
     * @param request 订单提交参数
     * @param orderKey 订单key
     * @return
     */
    HashMap<String, Object> computedOrder(OrderComputedRequest request, String orderKey);

    HashMap<String, Object> computedPickingOrder(OrderComputedRequest request, String orderKey);
    
    /**
     * 用户分账
     * @author daigb
     * @date:  2022-10-20 14:13
     */
    void transDivByOrder(StoreOrder storeOrder, List<StoreOrderInfo> storeOrderInfoList);
    
    /**
     * 推送订单到吉客云
     * @author daigb
     * @date:  2022-10-20 14:13
     */
    void pushOrderByJky(StoreOrder storeOrder);

    /**
     * 记录商品支付数量
     * @param orderId 订单id
     * @author duyb
     * @since 2020-10-19
     */
    void saveAddPurchaseNumber(StoreOrder storeOrder,List<StoreOrderInfo> storeOrderInfoList);

    /**
     * 支付
     * @param request 支付参数
     * @return 支付结果
     */
    Map<String, Object> payOrder(OrderPayRequest request, String ip);

    Map<String, Object> toPushPayOrder(StoreOrder storeOrder, String ip);

    /**
     * 查询订单状态
     * @param request 查询订单状态参数
     * @return 查询订单状态结果
     */
    Map<String, Object> getOrderStatus(OrderQueryRequest request);

    boolean payTest();
    /**
     * 订单列表
     * @param type 类型
     * @param searchWord 搜索条件: 订单号/商品名
     * @param pageRequest 分页
     * @return 订单集合
     */
    CommonPage<OrderAgainVo> list(Integer type,  String searchWord, PageParamRequest pageRequest);

    CommonPage<OrderAgainVo> pickingOrderList(Integer type,String orderNo, PageParamRequest pageRequest);

    /**
     * 订单详情
     * @param orderId 订单id
     */
    StoreOrderDetailResponse detailOrder(String orderId);

    /**
     * 订单状态数量
     * @return 订单状态数据量
     */
    OrderDataResponse orderData();

    OrderDataResponse pickingOrderData();

    /**
     * 查询退款理由
     * @return 退款理由集合
     */
    List<String> getRefundReason();

    Boolean delete(Integer id);

    boolean reply(StoreProductReplyAddRequest request);

    boolean take(Integer id);
    
    /**
     * job执行收货超时订单
     * @Description:  
     * @author daigb 
     * @param 
     * @return void
     * @throws
     */
    void batchTake();

    boolean cancel(Integer id);

    boolean cancel(StoreOrder storeOrder);

    boolean refundApply(OrderRefundApplyRequest request);

    /**
     * 订单退款前验证
     * @param request 退款参数
     */
    boolean refundVerify(OrderRefundVerifyRequest request);

    /**
     * 订单物流查看
     */
    Object expressOrder(String orderId);

    /**
     * 获取待评价商品信息
     * @param getProductReply 订单详情参数
     * @return 待评价
     */
    Object getReplyProduct(GetProductReply getProductReply);

    /**
     * 更换支付类型
     * @param payType 支付类型
     */
    boolean changePayType(String payType,String orderId);

    OrangeWechatAppletConfigVo getOrangeConfig();

    Object enableIntegral();

    Object enableIntegral(Integer merId);

    /**
     * 修改订单地址
     * @param request
     * @return
     */
    boolean updateOrderAddress(UpdateOrderAddressRequest request);

    /**
     * 修改自提手机号
     * @param id
     * @param toPhone
     * @return
     */
    boolean updateOrderToPhone(Integer id, String toPhone);

    /**
     * 订单可用优惠券列表
     * @param cartIds
     * @param isNew
     * @param merId
     * @return
     */
    List<StoreCouponUserResponse> listConfirmCoupons(List<Integer> cartIds, boolean isNew, Integer merId);

    Object submitPickingOrder(OrderCreateRequest orderRequest, String key, String ip);

    boolean updatePickingProduct(UpdatePickingProductRequest request);

    boolean tracking(StoreOrderSendRequest request);

}
